<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
?>

<!-- JavaScript -->


<html>
<head>
	<title>Cetak Presensi</title>
	<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
	
	<script type="text/javascript" src="<?= base_url() ?>js/wufoo.js"></script>
	<!--<script src="<?= base_url() ?>js/chosen.jquery.js" type="text/javascript"></script>-->
	<!-- CSS -->
	<!--<link rel="stylesheet" type="text/css" href="<?= base_url() ?>css/form/form.css" media="screen, tv, projection" title="Default" />-->
	<link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>css/datepicker.css" media="screen, tv, projection" title="Default" />
	<script type="text/javascript" src="<?= base_url() ?>js/datepicker.js"></script>
	<link rel="stylesheet" href="<?php echo base_url() ?>css/chosen.css" />
</head>

<style type="text/css">
table.stats{
	text-align: center;
	font-family: Verdana, Geneva, Arial, Helvetica, sans-serif ;
	font-weight: normal;
	font-size: 11px;
	color: #000000;
	width: 1000px;
	/* background-color: red;*/
	border: 0px;
	border-collapse: collapse;
	border-spacing: 0px;}

table.stats td{
	/* background-color: #900000;*/
	color: #000;
	padding: 4px;
	/*text-align: center;*/
	border: 2px #000000 solid;
	font-weight: bold;}

table.stats td.hed{
	background-color: #E73737;
	color: #fff;
	padding: 4px;
	/*text-align: center;*/
	border-bottom: 2px #FFABAB solid;
	font-size: 12px;
	font-weight: bold;}

.header {
    border:outset 1px #ccc;
    background:#999;
    color:#000000;
    font-weight:bold;
    padding: 1px 2px;
    background:url(../../../images/formbg2.gif) left top;
    border-collapse    : collapse;
    font-size        : 12px;
}
.tab {
    font-family        : Verdana;
	font-size          : 12px;
	color              : #000000;
	background-color   : #FFFFFF;
	border            : groove 2px #666666;
	border-collapse    : collapse;
}
.fieldset2{
	border-color:#CC0000;
	height:250px;
}
</style>
<?php 
if($type == 'xls'){
	header("Content-type: application/vnd.ms-excel");
	header("Content-Disposition: attachment;Filename=$filename.xls");
}
if($tglpresensi!=''){
	foreach($rs_presensi->result() as $row){
		$jenis_hadir[$row->NISN] = $row->JENIS_KEHADIRAN;
	}
}
?>

<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onLoad="cetak()">
<div>
<?if($type=='html'){?>
<table border=0 cellspacing="5" width="1000" style="font-size:12px;">
<tr>
	<td align="right" width="250"><img src="<?= base_url() ?>uploads/konfigurasi/<?= $url_logo->URL_LOGO_CETAK?>" width="110" height="100" ></td>
	<td valign="bottom"><font size="5"><?= $url_logo->TEXT_KETERANGAN?></font><br><font size="3" valign="top"><i><?= $instansi?></i></font></td>
</tr>	
<tr>
	<td colspan="2" align="center">&nbsp;</td>
</tr>
<tr>
	<td colspan="2" align="center"><font size="3"><b>DAFTAR ABSENSI SISWA</b></font></td>
</tr>
<tr>
	<td colspan="2" align="center">&nbsp;</td>
</tr>
</table>
<table border=0 cellspacing="1" width="1000" style="font-size:12px;">
<tr>
	<td align="left" width="100">Tahun Ajaran </td>
	<td align="left">: <?php echo $tahunajaran;?> </td>
</tr>
<tr>
	<td align="left" width="100">Semester</td>
	<td align="left">: <?php echo $r_semester;?> </td>
</tr>
<tr>
	<td align="left" width="100">Kelas</td>
	<td align="left">: <?php echo $r_kelas;?> </td>
</tr>
</table><br>
<table class="stats" cellspacing="0">
	<tr><td rowspan="2" width="50" align="center">No.</td>
		<td rowspan="2" width="100" nowrap align="center">NISN</td>
		<td rowspan="2" width="250" nowrap align="center">Nama Lengkap</td>
		<td colspan="5" width="30" align="center">Jenis Kehadrian</td>
		<td rowspan="2" width="300" align="center">Keterangan</td>
	</tr>
	<tr>
		<td width="36" nowrap>Hadir</td>
		<td width="36" nowrap>Alpha</td>
		<td width="36" nowrap>Sakit</td>
		<td width="36" nowrap>Ijin</td>
		<td width="36" nowrap>Cuti</td>
	</tr>
	<? $i=1; foreach($r_daftarsiswa->result() as $row){ ?>
		<tr>
			<td><?php echo $i++;?></td>
			<td><?php echo $row->NISN; ?></td>
			<td align="left"><?php echo $row->NAMA_LENGKAP; ?></td>
			<?for ($j=1;$j<=5;$j++){
			if($j==1) $val_jk='H'; else if($j==2) $val_jk='A'; else if($j==3) $val_jk='S';  else if($j==4) $val_jk='I'; else $val_jk='C';
				if($tglpresensi==''){
			?>
				<td>&nbsp;</td>
			<?
				}else{
			?>
				<td><?php if(!empty( $jenis_hadir[$row->NISN])){ if($val_jk == $jenis_hadir[$row->NISN]) echo $jenis_hadir[$row->NISN]; else echo '';}?></td>
			<?
				}
			}?>
			<?php if($tglpresensi=='') echo '<td>&nbsp;</td>'; else{?>
			<td><?php echo $row->KETERANGAN;?></td>
			<?}?>
		</tr>
	<?}?>
</TABLE><BR><BR>
<table cellspacing="0">
	<tr>
		<td align="left">Wali Kelas, </td>
	</tr>
	<tr height="40">
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="left"><?php if($r_walikelas->GELAR_DEPAN != '') ECHO $r_walikelas->GELAR_DEPAN.'. '; ELSE ECHO '';?><?PHP ECHO $r_walikelas->NAMA_LENGKAP;?><?PHP IF($r_walikelas->GELAR_BELAKANG != '') ECHO ', '.$r_walikelas->GELAR_BELAKANG?></td>
	</tr>
</table><br><br>
<?}else if($type=='xls' or $type=='pdf'){?>
<table border=0 cellspacing="5" width="300" style="font-size:12px;">
<tr>
	<td align="right" width="150"><img src="<?php if($type == 'xls') echo base_url(); else echo ''; ?>images/main/logo_sma.jpg" width="110" height="100" ></td>
	<td>&nbsp;</td>
	<td valign="bottom" width="300" colspan="3"><font size="6">SMA NEGERI 2 SIDOARJO</font><br><font size="3" valign="top"><i>Jl. Lingkar Barat Gading Fajar 2 Sidoarjo</i></font></td>
</tr>
<tr>
	<td colspan="5" align="center">&nbsp;</td>
</tr>	
<tr>
	<td colspan="5" align="center">&nbsp;</td>
</tr>
<tr>
	<td colspan="5" align="center"><font size="3"><b>DAFTAR ABSENSI SISWA</b></font></td>
</tr>
<tr>
	<td colspan="5" align="center">&nbsp;</td>
</tr>
</table>
<table border=0 cellspacing="1" width="400" style="font-size:12px;">
<tr>
	<td align="left" width="70">Tahun Ajaran </td>
	<td align="left">: <?php echo $tahunajaran;?> </td>
</tr>
<tr>
	<td align="left" width="70">Semester</td>
	<td align="left">: <?php echo $r_semester;?> </td>
</tr>
<tr>
	<td align="left" width="70">Kelas</td>
	<td align="left">: <?php echo $r_kelas;?> </td>
</tr>
</table><br>
<table width="500" border=1 style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif ;
	font-weight: normal;
	font-size: 11px;border-collapse: collapse;" cellspacing="0">
	<tr><td rowspan="2" width="20" align="center">No.</td>
		<td rowspan="2" width="50"  align="center">NISN</td>
		<td rowspan="2" width="150"  align="center">Nama Lengkap</td>
		<td colspan="5" width="30" nowrap align="center">Jenis Kehadrian</td>
		<td rowspan="2" width="200" align="center">Keterangan</td>
	</tr>
	<tr>
		<td width="20" align="center">Hadir</td>
		<td width="20" align="center">Alpha</td>
		<td width="20" align="center">Sakit</td>
		<td width="20" align="center">Ijin</td>
		<td width="20" align="center">Cuti</td>
	</tr>
	<? $i=1; foreach($r_daftarsiswa->result() as $row){ ?>
		<tr>
			<td width="10" align="center"><?php echo $i++;?></td>
			<td align="left"><?php echo $row->NISN; ?></td>
			<td width="150" align="left"><?php echo $row->NAMA_LENGKAP; ?></td>
			<?for ($j=1;$j<=5;$j++){
			if($j==1) $val_jk='H'; else if($j==2) $val_jk='A'; else if($j==3) $val_jk='S';  else if($j==4) $val_jk='I'; else $val_jk='C';
				if($tglpresensi==''){
			?>
				<td>&nbsp;</td>
			<?
				}else{
			?>
				<td align="center"><?php if(!empty( $jenis_hadir[$row->NISN])){ if($val_jk == $jenis_hadir[$row->NISN]) echo $jenis_hadir[$row->NISN]; else echo '';}?></td>
			<?
				}
			}?>
			<?php if($tglpresensi=='') echo '<td>&nbsp;</td>'; else{?>
			<td><?php echo $row->KETERANGAN;?></td>
			<?}?>
		</tr>
	<?}?>
</table><BR><BR>
<table cellspacing="0">
	<tr>
		<td align="left">Wali Kelas, </td>
	</tr>
	<tr height="40">
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="left"><?php if($r_walikelas->GELAR_DEPAN != '') ECHO $r_walikelas->GELAR_DEPAN.'. '; ELSE ECHO '';?><?PHP ECHO $r_walikelas->NAMA_LENGKAP;?><?PHP IF($r_walikelas->GELAR_BELAKANG != '') ECHO ', '.$r_walikelas->GELAR_BELAKANG?></td>
	</tr>
</table>
<?}else{?>
<table border=0 cellspacing="5" width="1000" style="font-size:12px;">
<tr>
	<td align="right" width="250"><img src="<?= base_url() ?>images/main/logo_sma.jpg" width="110" height="100" ></td>
	<td valign="bottom"><font size="6">SMA NEGERI 2 SIDOARJO</font><br><font size="3" valign="top"><i>Jl. Lingkar Barat Gading Fajar 2 Sidoarjo</i></font></td>
</tr>	
<tr>
	<td colspan="2" align="center">&nbsp;</td>
</tr>
<tr>
	<td colspan="2" align="center"><font size="3"><b>DAFTAR ABSENSI SISWA</b></font></td>
</tr>
<tr>
	<td colspan="2" align="center">&nbsp;</td>
</tr>
</table>
<table border=0 cellspacing="1" width="1000" style="font-size:12px;">
<tr>
	<td align="left" width="70">Tahun Ajaran </td>
	<td align="left">: <?php echo $tahunajaran;?> </td>
</tr>
<tr>
	<td align="left" width="70">Semester</td>
	<td align="left">: <?php echo $r_semester;?> </td>
</tr>
<tr>
	<td align="left" width="70">Kelas</td>
	<td align="left">: <?php echo $r_kelas;?> </td>
</tr>
</table><br>
<table class="stats" cellspacing="0">
	<tr><td rowspan="2" width="50" align="center">No.</td>
		<td rowspan="2" width="100" nowrap align="center">NISN</td>
		<td rowspan="2" width="250" nowrap align="center">Nama Lengkap</td>
		<td colspan="5" width="30" align="center">Jenis Kehadrian</td>
		<td rowspan="2" width="300" align="center">Keterangan</td>
	</tr>
	<tr>
		<td width="36" nowrap>Hadir</td>
		<td width="36" nowrap>Alpha</td>
		<td width="36" nowrap>Sakit</td>
		<td width="36" nowrap>Ijin</td>
		<td width="36" nowrap>Cuti</td>
	</tr>
	<? $i=1; foreach($r_daftarsiswa->result() as $row){ ?>
		<tr>
			<td><?php echo $i++;?></td>
			<td><?php echo $row->NISN; ?></td>
			<td align="left"><?php echo $row->NAMA_LENGKAP; ?></td>
			<?for ($j=1;$j<=5;$j++){?>
				<td></td>
			<?}?>
			<td></td>
		</tr>
	<?}?>
</table><BR><BR>
<table cellspacing="0">
	<tr>
		<td align="left">Wali Kelas, </td>
	</tr>
	<tr height="40">
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="left"><?php if($r_walikelas->GELAR_DEPAN != '') ECHO $r_walikelas->GELAR_DEPAN.'. '; ELSE ECHO '';?><?PHP ECHO $r_walikelas->NAMA_LENGKAP;?><?PHP IF($r_walikelas->GELAR_BELAKANG != '') ECHO ', '.$r_walikelas->GELAR_BELAKANG?></td>
	</tr>
</table>
<?}?>
</div>

</body>
<script type="text/javascript">
	function cetak(){
		window.print();
	}
</script>

</html>